Classify request
The classify node lets a language model decide which way a request takes. Typical requests are an incoming e-mail, a
ticket text or a chat message. You name the ways, describe each one in a sentence, and the model picks one. The workflow
then continues on that way. If the model cannot decide, or the answer is not usable, the request takes the edge next,
so nothing gets lost.
It does the job of the question-answering node followed by a condition on the answer, but in one step: the model does not write a word that you then have to compare, it chooses an edge and can hand over values it found in the text (a date, an order number).
The shipped example Classify Request sorts incoming mail into support request and appointment request.
How to wire it​
- Draw one edge from the classify node to a regular decision (the plain decision, without a condition type).
- Draw one edge from that decision for every way. The name of the edge is the name of the way, for example
support requestandappointment request. Do not put conditions on these edges, the model chooses. - Add the edge
nextto the decision. It takes everything the model could not place. - Draw an edge
activity errorfrom the classify node to a node of your choice (for example the end). It is taken when the language model cannot be reached.
New e-mail -> Classify -> Decision --support request--> Forward to support
--appointment request--> Tell reception
--next--> Ask the owner
--limit--> Ask the owner
Settings​
User prompt​
The request the model sees, usually built from variables of the workflow, for example:
Subject: ${email.subject}
${email.text}
The request comes from outside. Never let a way that deletes, pays or sends something run without a confirmation (for example a click response or an approval) behind it.
Routes​
A description for every way, as JSON. The model only sees these descriptions, so they decide how good the sorting is: say in one sentence when the way applies, as you would explain it to a colleague.
{
"support request": {
"description": "The sender has a problem with, or a question about, our product or service"
},
"appointment request": {
"description": "The sender wants to meet, call or book a time",
"arguments": {
"date": {"type": "date", "description": "the day the sender wishes for the appointment"}
}
}
}
The node editor has a field for each way of the decision, you do not have to write the JSON by hand. Every way of the decision needs an
entry (except next); the validation tells you about edges without a description and descriptions without an edge.
Arguments​
A way can ask the model for values it finds in the request. Types are string, integer, number, boolean and
date; a value is required unless you write "required": false. Each argument becomes a variable of that name on
that way only, for example ${date} after appointment request. If a required value is missing or has the wrong
type, the request takes next and classify.reason says why. Relative dates ("next Friday") are resolved with the
time zone parameter timezone (for example Europe/Berlin), or the one of the server.
An optional argument may be empty, and the validation warns when a later node uses it as if it were always there.
Process every action of a request​
By default a request takes exactly one way. Switch this on when one request can contain several (a mail that asks for
an appointment and reports a problem): the branches then lead back to the classify node, which takes the next
action each time. Add the edge done, it follows when every action has been processed. The request text must not
change on the way back.
Endpoint, model and advanced​
Like question answering: an endpoint and a model (empty means your default), temperature
(default 0, a decision should be repeatable), top P and the maximum length of the answer. The model must support tool
calls, the ways are offered to it as tools. A small local model that does not will answer without choosing; the
request then takes next.
System prompt​
Optional extra rules for the decision, for example "Mails from our own domain are never a support request". Variables are resolved.
Edges and variables​
| Edge | Taken when |
|---|---|
| name of a way | the model chose it and its values are valid |
next | the model chose nothing, something unknown, or invalid values (see classify.reason) |
limit | the request limit of the community edition is used up (see below); without this edge next is taken |
done | with process every action: every action is processed |
activity error | the language model could not be reached |
The node writes these variables:
| Variable | Content |
|---|---|
classify.route | the edge that was taken |
classify.outcome | what became of the decision: routed, no-fit, invalid-argument, unknown-tool or done |
classify.reason | why a request, or a part of it, was not processed (text for people) |
classify.answer | the text of the model, if it wrote any |
classify.calls | every action the model asked for |
classify.decision.id | identifies the decision, for example in its record |
| the arguments | on their way only, see above |
Community edition​
Without a license a diagram may let the model decide 20 requests within any 7 days (rolling, counted per diagram).
Further requests are not sent to the model: they take the edge limit, or next if there is none. The node editor shows
how many requests are used, and the validation warns when limit is missing. Dry runs and tests do not count. More in
Editions.
Keeping decisions as examples​
For quality work, for example building and checking a classifier, a node can keep its requests and the decisions as
examples. This is off by default and needs two switches: the operator switches recording on for the server
(workflow.decisions.record.enabled), and the node opts in (Keep requests and decisions of this node as examples,
parameter record.decisions). The requests are stored for 90 days and can contain personal data, so tell the people
whose requests are classified. A running workflow never reads these records; they are only for building and checking.
The assistant never sets this option on its own.
Tips​
- Name the ways like a person would say them ("appointment request"), they are part of what the model reads.
- Start with two or three ways. More ways need better descriptions; check the result with a few real requests in a dry run (the test run of the editor) before you let it loose.
- Put the most important distinction in the first sentence of the description.
- A request the model cannot place is not an error: give
nexta useful place, for example a message to a person.